<?php
/**
 * Created by PhpStorm.
 * User: lwh
 * Date: 2017/7/24
 * Time: 16:18
 */

?>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
    <!-- meta使用viewport以确保页面可自由缩放 -->
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- 引入 jQuery Mobile 样式 -->
    <link rel="stylesheet" href="css/jquery.mobile-1.4.5.min.css">
    <script type="text/javascript" src="js/jquery-1.7.min.js"></script>
    <!-- 引入 jQuery Mobile 库 -->
    <script type="text/javascript" src="js/jquery.mobile-1.4.5.min.js"></script>

    <title>测试数据传输</title>
    <script type="text/javascript">

        $(document).ready(function(){
            var action = "controller/getTaskInfo.php";
            var data = {
                "taskid": 2,
                "latitude": 31.196204,
                "longitude": 121.60448
            };

            $.ajax({
                type: "POST",
                url: action,
                data: {data:JSON.stringify(data)},
                success: function(response)
                {
//                    var result = response.trim();
                    $("#message").html('<p class="error">输出内容：' +  JSON.stringify(JSON.parse(response.trim().replace(/\n/g,"\\\\n"))) + '</p>');
                },
				error:function(request){
					alert("connection error");
				}
            });
        });
    </script>
</head>
<body>

<div class="container">
    <div id="message"></div>
</div>
</body>
</html>
